<div class="card border-0 rounded-0">
    <div class="card-body">
        <div class="form-group">
            <label>标题</label>
            <input type="text" name="title" value="{{old('title',$articlemodel['title']??'')}}"
   {{-- old('title',isset($articlemodel['title'])?$articlemodel['title']:'') --}}
            {{--还可以写成下面的样式,$articlemodel['title']??''表示如果$articlemodel['title']有值就取$articlemodel['title']中的值,没有值的话就取??后面的''--}}
                     class="form-control">
        </div>
        @if(isset($categorys))
            <div class="form-group">
                <label>文章所属栏目</label>
                <select name="category_id"  class="form-control">
                    @foreach($categorys as $lanmu)
                        <option value="{{$lanmu['id']}}"
                                {{--判断是否该默认选中--}}
                                {{$lanmu['id']==$articlemodel->category->id?'selected':''}}
                                {{--用户修改文章栏目的时候只能选在同一个content模型下的栏目--}}
      {{ $lanmu['content_model_id'] != $articlemodel->category->content_model_id?'disabled':'' }}
                        >{{$lanmu['_title']}}</option>
                    @endforeach
                </select>
            </div>
        @endif

        <div class="form-group">
            <label>缩略图</label>
            <div class="col-sm-12">
                <div class="input-group mb-1">
                    <input class="form-control" name="thumb" readonly value="{{old('thumb',
                    isset($articlemodel['thumb'])?$articlemodel['thumb']:'')}}">
                    <div class="input-group-append">
                        <button onclick="upImagePc(this)" class="btn btn-outline-secondary" type="button">单图上传</button>
                    </div>
                </div>
                <div style="display: inline-block;position: relative;">
                    <img src="{{asset('images/del.jpg')}}" class="img-responsive img-thumbnail" width="150">
                    <em class="close" style="position: absolute;top: 3px;right: 8px;" title="删除这张图片"
                        onclick="removeImg(this)">×</em>
                </div>
            </div>
            <script>
                require(['hdjs', 'bootstrap']);

                //上传图片
                function upImagePc() {
                    require(['hdjs'], function (hdjs) {
                        var options = {
                            multiple: false,//是否允许多图上传
                            //data是向后台服务器提交的POST数据
                            data: {name: '后盾人', year: 2099},
                        };
                        hdjs.image(function (images) {
                            console.log(images)
                            //上传成功的图片，数组类型
                            $("[name='thumb']").val(images[0]);
                            $(".img-thumbnail").attr('src', images[0]);
                        }, options)
                    });
                }

                //移除图片
                function removeImg(obj) {
                    $(obj).prev('img').attr('src', "{{asset('images/del.jpg')}}");
                    $(obj).parent().prev().find('input').val('');
                }
            </script>
        </div>

        {{--内容简介--}}
        <div class="form-group">
            <label>内容简介</label>
            <input type="text" name="description"
         value="{{old('descripttion',isset($articlemodel['description'])?$articlemodel['description']:'')}}"
                   class="form-control">
        </div>
        <div class="form-group">
            <label>内容</label>
            <textarea id="container" style="height:300px;width:100%;" name="content">
                {{ old('content',isset($articlemodel['content'])?$articlemodel['content']:'')  }}
            </textarea>
            @push('js')
                <script>
                    require(['hdjs'], function (hdjs) {
                        hdjs.ueditor('container');
                    })
                </script>
            @endpush
        </div>
        <div class="form-group">
            <label>内容来源</label>
            <input type="text" name="source" value="{{old('source',
            isset($articlemodel['source'])?$articlemodel['source']:'')}}" class="form-control">
        </div>
        <div class="form-group">
            <label>作者</label>
            <input type="text" name="author" value="{{old('author',
            isset($articlemodel['author'])?$articlemodel['author']:'')}}" class="form-control">
        </div>
        <div class="form-group">
            <label>跳转链接</label>
            <input type="text" name="redirect_url" value="{{old('redirect_url',
            isset($articlemodel['redirect_url'])?$articlemodel['redirect_url']:'')}}" class="form-control">
            <small id="helpId" class="text-muted">
                设置跳转链接后将不显示内容，直接跳转到网址
            </small>
        </div>
        <div class="form-group">
            <label>查看次数</label>
            <input type="text" name="clicks" value="{{old('click',0)}}" required class="form-control">
        </div>
    </div>
</div>
<div class="card">
    <div class="card-header">
        扩展字段
    </div>
    <div class="card-body">
        {{--将获取到的扩展字段相关的html代码原样展示在页面中(不需要实体化)--}}
        {!! $extendField !!}
    </div>
    <div class="card-footer text-muted">
        <button class="btn btn-primary btn-sm">保存提交</button>
    </div>
</div>